#coding=utf-8
import re

'''
' [多行]2.6.3-1 逻辑嵌套不要超过3层
'''
def mzcc_udrule_mul2_6_3__1(bufferItem, lineContext):

    # 逻辑开始
    if None == bufferItem.userDefineInfo:
        bufferItem.userDefineInfo = 0;

    # 检测嵌套开始&结束
    results = re.findall(r"{", lineContext.curNspLine);
    bufferItem.userDefineInfo += len(results);
    results = re.findall(r"}", lineContext.curNspLine);
    bufferItem.userDefineInfo -= len(results);

    if 0 == bufferItem.userDefineInfo:
        bufferItem.userDefineInfo = None;
        return 0;

    if bufferItem.userDefineInfo >= 5:
        bufferItem.lineNum = lineContext.curLineNum;
        bufferItem.userDefineInfo = None;
        return 1;

    return 2;
